from django.db import models
import datetime


class BasicUser(models.Model):
    user_id = models.CharField(max_length=200, primary_key=True, verbose_name="用户ID")
    user_name = models.CharField(max_length=20, verbose_name="用户名")
    password = models.CharField(max_length=100, verbose_name="密码")
    real_name = models.CharField(max_length=20, verbose_name="姓名")
    collage_id = models.CharField(max_length=20, verbose_name="学院id")
    email = models.CharField(max_length=50, verbose_name="邮箱地址")
    sex = models.CharField(max_length=2, verbose_name="用户性别", help_text="0 代表 保密， 1 代表男， 2 代表女")
    user_type = models.CharField(max_length=2, verbose_name="用户类型", help_text="0 代表 学生， 1 代表教职工")
    create_time = models.DateTimeField(auto_now_add=True, help_text="创建时间")
    update_time = models.DateTimeField(auto_now=True, help_text="更新时间")

    def __str__(self):
        return "姓名：" + self.real_name + " 用户类别：" + ("学生" if self.user_type == "0" else "教职工")
